Repository navigation
Conversation
…ral shape Crest factor (ratio or dB), Pearson kurtosis of the samples, and the centroid, spread, flatness and rolloff of the power spectrum, one value per channel. Tests use signals with exact values: crest factor of a sine and a square wave, kurtosis of a sine and of Gaussian noise, the spectral shape of a sine, and the flatness, rolloff and centroid of white noise. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the module
pytta.descriptorswith descriptors of a whole signal, one value per channel:crest_factor(signalObj, dB=False): peak magnitude over rms.kurtosis(signalObj): Pearson kurtosis of the samples, used to rate how impulsive a noise or vibration is (3 for Gaussian noise).spectral_centroid,spectral_spread,spectral_flatnessandspectral_rolloff(signalObj, fraction=0.85): power-weighted mean frequency, its standard deviation, the geometric over arithmetic mean of the power spectrum, and the frequency below which a fraction of the power lies.The tests in
tests/test_descriptors.pyuse signals with exact values: a crest factor of sqrt(2) (3.01 dB) for a sine and 1 for a square wave, a kurtosis of 1.5 for a sine and 3 for Gaussian noise, a centroid of 1000 Hz with zero spread and flatness for a 1 kHz sine, and for white noise a flatness of exp(-gamma) = 0.5615 (the power of each bin is exponentially distributed), a rolloff of 0.85 fs/2 and a centroid of fs/4.Checked with Python 3.12, numpy 1.26 and scipy 1.17. The existing tests behave as on
development: the 7 failures there (3 intest_h5io.py, 4 intest_pyttasave.py) are the same with and without this change.Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com